package com.heavenbird.common.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;

public class JsonUtil {
	private static transient Log log = LogFactory.getLog(JsonUtil.class);
	private static ObjectMapper mapper = new ObjectMapper();
	
	public static ObjectWriter getObejectWriter(Class<?> rootType) {
		return JsonUtil.mapper.writerWithType(rootType);
	}
	
	public static ObjectReader getObejectReader(Class<?> rootType) {
		return JsonUtil.mapper.reader(rootType);
	}
}
